<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title></title>
		<script type="text/javascript" src="js/axios.js"></script>
		<script type="text/javascript" src="js/vue.js"></script>
		<script type="text/javascript" src="js/qs.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<link rel="stylesheet" href="element/theme-chalk/index.css">
		<script src="element/index.js"></script>
</head>

<body>
	<!--会员管理-->
	<div id="admin">
		<!--导航栏-->
		<el-col :span="4">
			<!-- <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"> -->
			<el-menu default-active="1" class="el-menu-vertical-demo">
				<el-menu-item index="1" @click="status=1">
					<i class="el-icon-user"></i>
					<span slot="title">会员管理</span>
				</el-menu-item>
				<el-menu-item index="2" @click="selectCoach">
					<i class="el-icon-s-custom"></i>
					<span slot="title">教练管理</span>
				</el-menu-item>
				<el-menu-item index="3" @click="status=3">
					<i class="el-icon-shopping-cart-full"></i>
					<span slot="title">课程管理</span>
				</el-menu-item>
				<el-menu-item index="4" @click="showEquipment">
					<i class="el-icon-suitcase"></i>
					<span slot="title">器材管理</span>
				</el-menu-item>
				<el-menu-item index="5" @click="status=5">
					<i class="el-icon-goods"></i>
					<span slot="title">订单管理</span>
				</el-menu-item>
			</el-menu>
		</el-col>
		<!--会员管理-->
		<el-col :span="20" v-if="status==1">
			<el-input placeholder="请输入要搜索的用户名称" v-model="memberinputName" prefix-icon="el-icon-search"
				style="width: 300px;">
			</el-input>
			<el-button @click="searchByMemberName">搜索</el-button>
			<el-button @click="addMemberButton" type="primary">新增会员账户</el-button>
			<el-dialog title="新增会员信息" :visible.sync="dialogMemberTableAdd">
				<el-form :model="addMemberForm" :label-position="labelPosition" label-width="80px">
					<el-form-item property="userNam" label="姓名">
						<el-input style="width: 200px;" v-model="addMemberForm.userName" autocomplete="off"></el-input>
					</el-form-item>
					<el-form-item property="sexId" label="性别">
						<el-radio-group v-model="addMemberForm.sexId">
							<el-radio-button label="1">男</el-radio-button>
							<el-radio-button label="0">女</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item property="userPhone" label="手机号码">
						<el-input style="width: 200px;" v-model="addMemberForm.userPhone" autocomplete="off"></el-input>
					</el-form-item>
					<el-form-item property="birth" label="生日">
						<el-date-picker v-model="addMemberForm.birth" type="date" value-format="yyyy-MM-dd"
							placeholder="选择日期" style="width: 200px;">
						</el-date-picker>
					</el-form-item>
					<el-form-item property="password" label="密码">
						<el-input style="width: 200px;" v-model="addMemberForm.password" autocomplete="off"></el-input>
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">
					<el-button @click="dialogMemberTable = false">取 消</el-button>
					<el-button type="primary" @click="addMember">确认新增</el-button>
				</div>
			</el-dialog>
			<el-table :data="memberTable" stripe style="width: 100%">
				<el-table-column prop="id" label="序号" width="180">
				</el-table-column>
				<el-table-column prop="userName" label="姓名" width="180">
				</el-table-column>
				<el-table-column prop="userPhone" label="电话号码" width="180">
				</el-table-column>
				<el-table-column label="操作">
					<template slot-scope="scope" v-if="status==1">

						<el-button @click="editMember(scope)" type="info">修改会员信息</el-button>
						<el-popconfirm title="是否确认注销" @confirm="deleteMember(scope)" placement="right">
							<el-button type="danger" slot="reference">
								注销会员
							</el-button>
						</el-popconfirm>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page=memberpageNum :page-sizes="[1, 2, 3 ,4]" :page-size=memberpageSize
				layout="total, sizes, prev, pager, next, jumper" :total=membertotal>
			</el-pagination>
			<el-dialog title="会员信息修改" :visible.sync="dialogMemberTable">
				<el-form :model="userForm" :label-position="labelPosition" label-width="80px">
					<el-form-item label="昵称" prop="name">
						<el-input v-model="userForm.userName" style="width: 200px;"></el-input>
					</el-form-item>
					<el-form-item label="性别" prop="sexId">
						<el-radio-group v-model="userForm.sexId">
							<el-radio-button label="1">男</el-radio-button>
							<el-radio-button label="0">女</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="生日" prop="birth">
						<el-date-picker v-model="userForm.birth" type="date" value-format="yyyy-MM-dd"
							placeholder="选择日期" style="width: 200px;">
						</el-date-picker>
					</el-form-item>
					<el-form-item label="手机号" prop="phone">
						<el-input v-model="userForm.userPhone" type="text" style="width: 200px;font-size: 16px;">
						</el-input>
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">

					<el-button @click="dialogMemberTable = false">取 消</el-button>
					<el-button type="primary" @click="updatedMemberInfo">确认修改</el-button>
				</div>
			</el-dialog>
		</el-col>
		<!--教练管理-->
		<el-col :span="20" v-if="status==2">
			<el-input placeholder="请输入要搜索的教练姓名" v-model="coachinputName" prefix-icon="el-icon-search"
				style="width: 300px;">
			</el-input>
			<el-button @click="searchByCoachName">搜索</el-button>
			<!-- <el-button @click="addMemberButton" type="primary">新增会员账户</el-button> -->
			<el-button @click="addCoachButton" type="primary">新增教练账户</el-button>
			<el-table :data="coachTable" stripe style="width: 100%">
				<el-table-column prop="id" label="序号" width="180">
				</el-table-column>
				<el-table-column prop="coachName" label="姓名" width="180">
				</el-table-column>
				<el-table-column prop="sexId" label="性别" width="180">
					<template slot-scope="scope">
						<span v-if="scope.row.sexId == 1">男</span>
						<span v-if="scope.row.sexId == 0">女</span>
					</template>
				</el-table-column>
				<el-table-column prop="style" label="风格" width="180">
				</el-table-column>
				<el-table-column prop="coachPhone" label="电话号码">
				</el-table-column>
				<el-table-column label="操作">
					<template slot-scope="scope" v-if="status==2">
						<el-dialog title="教练信息注册" :visible.sync="dialogCoachTable">
							<el-form :model="addCoachForm" :label-position="labelPosition" label-width="80px">
								<el-form-item label="真实姓名" prop="name">
									<el-input v-model="addCoachForm.coachName" style="width: 200px;"></el-input>
								</el-form-item>
								<el-form-item label="性别" prop="sex">
									<el-radio-group v-model="addCoachForm.sexId">
										<el-radio-button label="1">男</el-radio-button>
										<el-radio-button label="0">女</el-radio-button>
									</el-radio-group>
								</el-form-item>
								<el-form-item label="风格" prop="style">
									<el-input v-model="addCoachForm.style" style="width: 200px;"></el-input>
								</el-form-item>
								<el-form-item label="手机号" prop="phone">
									<el-input v-model="addCoachForm.coachPhone" type="text" style="width: 200px;">
									</el-input>
								</el-form-item>
								<el-form-item label="密码" prop="password">
									<el-input v-model="addCoachForm.password" type="text" style="width: 200px;">
									</el-input>
								</el-form-item>
							</el-form>
							<div slot="footer" class="dialog-footer">
								<!-- <el-button @click="dialogSubjectTable = false">取 消</el-button>
					<el-button type="primary" @click="addMember">确认新增</el-button> -->
								<el-button @click="dialogCoachTable = false">取 消</el-button>
								<el-button type="primary" @click="addCoach">确认新增</el-button>
							</div>
						</el-dialog>
						<el-popconfirm title="是否确认注销" @confirm="deleteCoach(scope)" placement="right">
							<el-button type="danger" slot="reference">
								注销教练
							</el-button>
						</el-popconfirm>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination @size-change="coachHandleSizeChange" @current-change="coachHandleCurrentChange"
				:current-page=coachpageNum :page-sizes="[1, 2, 3 ,4]" :page-size=coachpageSize
				layout="total, sizes, prev, pager, next, jumper" :total=coachtotal>
			</el-pagination>
		</el-col>


		<!--课程管理-->
		<el-col :span="20" v-if="status==3">
			<el-input placeholder="请输入要搜索的课程信息" v-model="subjectinputName" prefix-icon="el-icon-search"
				style="width: 300px;">
			</el-input>
			<el-button @click="searchBySubjectName">搜索</el-button>
			<el-button @click="addSubjectButton" type="info">添加课程</el-button>
			<el-table :data="subjectTable" stripe style="width: 100%">
				<el-table-column prop="subjectId" label="课程编号" width="140">
				</el-table-column>
				<el-table-column prop="subjectName" label="课程名称" width="140">
				</el-table-column>
				<el-table-column prop="subjectPrice" label="课程价格" width="140">
				</el-table-column>
				<el-table-column prop="startDate" label="开始时间" width="140">
				</el-table-column>
				<el-table-column prop="endDate" label="结束时间" width="180">
				</el-table-column>
				<el-table-column prop="coachName" label="课程教练" width="180">
				</el-table-column>
				<el-table-column label="操作">
					<template slot-scope="scope" v-if="status==3">
						<el-dialog title="课程信息添加" :visible.sync="dialogSubjectTable">
							<el-form :model="addSubjectForm" :label-position="labelPosition" label-width="80px">
								<el-form-item label="课程名称" prop="subject">
									<el-input v-model="addSubjectForm.subjectName" style="width: 200px;"></el-input>
								</el-form-item>
								<el-form-item label="课程价格" prop="price">
									<el-input v-model="addSubjectForm.subjectPrice" type="text" style="width: 200px;">
									</el-input>
								</el-form-item>
								<el-form-item label="开始时间" prop="date">
									<el-date-picker v-model="addSubjectForm.startDate" type="date" value-format="yyyy-MM-dd"
										placeholder="选择日期" style="width: 200px;">
									</el-date-picker>
								</el-form-item>
								<el-form-item label="结束时间" prop="date">
									<el-date-picker v-model="addSubjectForm.endDate" type="date" value-format="yyyy-MM-dd"
										placeholder="选择日期" style="width: 200px;">
									</el-date-picker>
								</el-form-item>
								<el-form-item label="课程教练" prop="coach">
									<el-input v-model="addSubjectForm.coachId" type="text" style="width: 200px;">
									</el-input>
								</el-form-item>
							</el-form>
							<!-- <el-button @click="dialogSubjectTable = false">取 消</el-button>
					<el-button type="primary" @click="addMember">确认新增</el-button> -->
							<div slot="footer" class="dialog-footer">
								<el-button @click="dialogSubjectTable = false">取 消</el-button>
								<el-button type="primary" @click="addSubject">确认新增</el-button>
							</div>
						</el-dialog>
						<el-popconfirm title="是否确认删除" @confirm="deleteSubject(scope)" placement="right">
							<el-button type="danger" slot="reference">
								删除课程
							</el-button>
						</el-popconfirm>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination @size-change="subjectHandleSizeChange" @current-change="subjectHandleCurrentChange"
				:current-page=subjectpageNum :page-sizes="[1, 2, 3 ,4]" :page-size=subjectpageSize
				layout="total, sizes, prev, pager, next, jumper" :total=subjecttotal>
			</el-pagination>
		</el-col>
		<!--订单管理-->
		<el-col :span="20" v-if="status==5">
			<el-input placeholder="根据用户名/课程名称/订单号搜索订单信息" v-model="orderinputName" prefix-icon="el-icon-search" style="width: 300px;">
			</el-input>
			<el-button @click="searchOrderByMemberName">搜索</el-button>
			<el-table :data="orderTable" stripe style="width: 100%">
				<!-- OrdersDto(id=18, subjectId=4, memberId=52, dealTime=Mon Jun 06 00:00:00 CST 2022, subject=SubjectDto(subjectId=4, coachId=4, coachName=花城, duration=30, number=20, subjectName=压力车, subjectPrice=50.0, startDate=Sun Oct 23 00:00:00 CST 2022, endDate=Thu Dec 01 00:00:00 CST 2022, subjectPhoto=null, subjectList=null, subjectTotal=null, pageSize=null, pageNum=null, searchName=null), member=Member(id=52, userName=Jano, userPhone=123, password=123, balance=123.00, photo=http://49.234.18.194:8080/image/1.jpg , payPassword=123, sexId=1, birth=Fri Jan 01 00:00:00 CST 2021), price=0.0) -->
				<el-table-column prop="id" label="序号" width="180">
				</el-table-column>
				<el-table-column prop="member.userName" label="用户名" width="180">
				</el-table-column>
				<el-table-column prop="subject.subjectName" label="课程名称" width="180">
				</el-table-column>
				<el-table-column prop="subject.subjectPrice" label="课程价格" width="180">
				</el-table-column>
				<el-table-column prop="orderId" label="订单号" width="180">
				</el-table-column>
				<el-table-column label="操作">
					<template slot-scope="scope" v-if="status==5">
						<el-popconfirm title="是否确认删除" @confirm="deleteOrder(scope)" placement="right">
							<el-button type="danger" slot="reference">
								删除订单
							</el-button>
						</el-popconfirm>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination @size-change="orderHandleSizeChange" @current-change="orderHandleCurrentChange"
				:current-page=orderpageNum :page-sizes="[1, 2, 3 ,4]" :page-size=orderpageSize
				layout="total, sizes, prev, pager, next, jumper" :total=ordertotal>
			</el-pagination>
		</el-col>


		<!--器材管理-->
		<el-col :span="20" v-if="status==4">
			<el-input placeholder="请输入要搜索的器材名称" prefix-icon="el-icon-search" style="width: 300px;"
				v-model="equipInput" >
			</el-input>
			<el-button type="primary" @click="searchEquip">搜索</el-button>
			<el-button @click="addEquip" type="info">添加器材</el-button>
			<el-dialog title="器材信息添加" :visible.sync="dialogEquipTable">
				<el-form :model="equipForm" :label-position="labelPosition" label-width="80px">
					<el-form-item label="器材编号" prop="id">
						<el-input v-model="equipForm.id" style="width: 200px;"></el-input>
					</el-form-item>
					<el-form-item label="器材名称" prop="name">
						<el-input v-model="equipForm.name" style="width: 200px;"></el-input>
					</el-form-item>
					<el-form-item label="器材价格" prop="price">
						<el-input v-model="equipForm.price" type="text" style="width: 200px;">
						</el-input>
					</el-form-item>
					<el-form-item label="器材简介" prop="description">
						<el-input v-model="equipForm.description" type="text" style="width: 200px;">
						</el-input>
					</el-form-item>
					<el-form-item label="器材类型" prop="type">
						<el-input v-model="equipForm.type" type="text" style="width: 200px;">
						</el-input>
					</el-form-item>
					<el-form-item label="器材状态" prop="stateId">
						<el-select v-model="equipForm.stateId" placeholder="请选择状态">
							<el-option v-for="item in options" :key="item.id" :label="item.value" :value="item.id">
							</el-option>
						</el-select>
		
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">
					<el-button @click="dialogEquipTable = false">取 消</el-button>
					<el-button type="primary" @click="submitEquip">确认新增</el-button>
				</div>
			</el-dialog>
			<el-table :data="equipTable" stripe style="width: 100%">
				<el-table-column prop="id" label="器材编号" width="180">
				</el-table-column>
				<el-table-column prop="name" label="器材名称" width="180">
				</el-table-column>
				<el-table-column prop="price" label="器材价格" width="180">
				</el-table-column>
				<el-table-column prop="descripton" label="器材简介" width="180">
				</el-table-column>
				<el-table-column prop="type" label="器材类型" width="180">
				</el-table-column>
				<el-table-column prop="stateId" label="器材状态" width="180">
				</el-table-column>
		
				<el-table-column label="操作">
					<template slot-scope="scope" v-if="status==4">
						<el-popconfirm title="是否确认删除" @confirm="removeEquip(scope)" placement="right">
							<el-button type="danger" slot="reference">
								删除器材
							</el-button>
						</el-popconfirm>
		
					</template>
				</el-table-column>
		
			</el-table>
			<el-pagination @size-change="equipHandleSizeChange" @current-change="equipHandleCurrentChange"
				:current-page="equipCurrentPage" :page-sizes="[5, 6, 7, 8]" :page-size="equipPageSize"
				layout="total, sizes, prev, pager, next, jumper" :total="equipTotal">
			</el-pagination>
		</el-col>
		</div>

</body>
<!--会员管理-->
<script>
	new Vue({
		el: "#admin",
		data() {
			return {
				status: 1,
				dialogSubjectTable: false,
				dialogMemberTable: false,
				dialogMemberTableAdd: false,
				dialogCoachTable: false,
				visible: false,
				dialogOrderTable: false,
				labelPosition: 'left',
				memberpageSize: 1,
				memberinputName: "",
				membersearchName: "",
				memberpageNum: 1,
				membertotal: 10,
				memberTable: [],
				userForm: {},
				addMemberForm: {},
				coachpageSize: 1,
				coachpageNum: 1,
				coachtotal: 10,
				coachinputName: "",
				coachsearchName: "",
				coachTable: [],
				coachForm: {},
				addCoachForm: {},

				subjectTable: [],
				subjectinputName: "",
				subjectsearchName: "",
				subjectpageSize: 1,
				subjectpageNum: 1,
				subjecttotal: 10,
				addSubjectForm: {},

				orderTable: [],
				orderinputName: "",
				ordersearchName: "",
				orderpageSize: 1,
				orderpageNum: 1,
				ordertotal: 10,
				addOrderForm: {},
				equipPageSize: 5,
				equipCurrentPage: 1,
				labelPosition: "left",
				equipTotal: 10,
				//器材
				dialogEquipTable: false,
				equipTable: [],
				equipInput: '',
				equipForm: {
					id: '',
					name: '',
					price: '',
					descripton: '',
					type: '',
					stateId: ''
				},
				options: [],
				password: [{
					required: true,
					message: '密码不能为空',
					trigger: 'blur'
				}, {
					validator: (rule, value, callback) => {
						if (/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/.test(value)) {
							callback();
						} else {
							callback(new Error("密码必须包含字母和数字，且在6~18位之间"));
						}
					},
					trigger: "blur"
				}],

			}
		},
		watch: {
		    // 如果 `equipInput` 发生改变，这个函数就会运行
		    equipInput: function() {
				let _this = this;
				// _this.clearEquipInput();
		      if (_this.equipInput.length == 0) {
		        axios.post("/equipment/searchEquipByName", {
		        	pageSize: _this.equipPageSize,
		        	currentPage: _this.equipCurrentPage,
		        	name: _this.equipInput,
		        }, {
		        	headers: {
		        		'Content-Type': 'application/x-www-form-urlencoded'
		        	},
		        	transformRequest: function(data) {
		        		return Qs.stringify(data);
		        	}
		        }).then(function(res) {
		        	
		        	_this.equipTotal = res.data.data.total;
		        	var resdata = res.data.data.equipmentList;
		        	console.log("--------------------")
		        	console.log(resdata)
		        	_this.equipTable = resdata;
		        }).catch(error => {})
		      }
		    }
		  },
		methods: {
			equipHandleSizeChange(value) {
				let _this = this;
				_this.equipPageSize = value;
				_this.equipCurrentPage = 1;
				_this.loadEquipment();
				_this.getmemberData();
			},
			equipHandleCurrentChange(value) {
				let _this = this;
				_this.equipCurrentPage = value;
				_this.loadEquipment();
				_this.getmemberData();
			},
			
			
			searchEquip() {
				let _this = this;
				axios.post("/equipment/searchEquipByName", {
					pageSize: _this.equipPageSize,
					currentPage: _this.equipCurrentPage,
					name: _this.equipInput,
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function(data) {
						return Qs.stringify(data);
					}
				}).then(function(res) {
					
					_this.equipTotal = res.data.data.total;
					var resdata = res.data.data.equipmentList;
					console.log("--------------------")
					console.log(resdata)
					_this.equipTable = resdata;
				}).catch(error => {})
			},
			
			addEquip() {
				let _this = this;
				_this.dialogEquipTable = true;
				axios.get("/equipment/showState").then(function(res) {
					_this.options = res.data.data;
					console.log(res);
				});
			
			},
			removeEquip(scope) {
				let _this = this;
				console.log("删除")
				axios.post("/equipment/del", {
					id: scope.row.id,
			
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function(data) {
						return Qs.stringify(data);
					}
				}).then(function(res) {
					console.log(res)
					_this.equipHandleCurrentChange(_this.equipCurrentPage);
					_this.getmemberData();
				}).catch(error => {})
			},
			//提交新增器材信息
			submitEquip() {
				console.log("提交新增信息");
				let _this = this;
				_this.dialogEquipTable = false;
			
				axios.post("/equipment/add", {
					id: _this.equipForm.id,
					name: _this.equipForm.name,
					price: _this.equipForm.price,
					description: _this.equipForm.description,
					type: _this.equipForm.type,
					stateId: _this.equipForm.stateId
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function(data) {
						return Qs.stringify(data);
					}
				}).then(function(res) {
					console.log(res)
			
					var resdata = res.data.data.equipmentList
					console.log(resdata)
			
				}).catch(error => {})
			},
			
			showEquipment() {
				let _this = this;
				_this.status = 4;
				_this.equipInput='';
				_this.loadEquipment();
			},
			loadEquipment() {
				let _this = this;
				axios.get("/equipment/show", {
					//这里的params最终会被解析成 ?参数名=参数值&参数名=参数值&……带在地址栏的后面
					params: {
						pageSize: _this.equipPageSize,
						currentPage: _this.equipCurrentPage,
					}
				}).then(function(res) {
					console.log(res)
					_this.equipTable = res.data.data.equipmentList;
					_this.equipTotal = res.data.data.total;
					// JSON.stringify(res.data.data);
					console.log(res);
					console.log('下面是测试器材界面情况');
				});
			},
			deleteRow(index, rows) {
				rows.splice(index, 1);
			},
			getmemberData() {
				let _this = this;
				axios.post("/adminuser/getmembers", {
					pageSize: _this.memberpageSize,
					pageNum: _this.memberpageNum,
					userName: _this.membersearchName
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					_this.membertotal = res.data.data.memberTotal
					var resdata = res.data.data.memberList
					console.log(resdata)
					_this.memberTable = resdata;
					_this.userForm.sexId = resdata.sexId
				}).catch(error => {
					// location.href = "login.html";
				})
			}, //分页
			handleSizeChange(val) {
				let _this = this;
				console.log(val + "-------------------")
				_this.memberpageSize = val;
				_this.memberpageNum = 1;
				_this.getmemberData()
			},
			handleCurrentChange(val) {
				let _this = this;
				_this.memberpageNum = val;
				_this.getmemberData()
			},
			editMember(rowid) {
				let _this = this;
				console.log(rowid.row.id)
				_this.dialogMemberTable = true;
				axios.post("/adminuser/getmemberById", {
					id: rowid.row.id,
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res.data.data)
					var memberInfo = res.data.data
					_this.userForm = memberInfo
					_this.getmemberData();
				}).catch(error => {})
			},
			updatedMemberInfo() {
				let _this = this
				_this.dialogMemberTable = false;
				console.log("---------------------")
				console.log(_this.userForm.userPhone)
				axios.post("/adminuser/updateMember", {
					id: _this.userForm.id,
					userPhone: _this.userForm.userPhone,
					userName: _this.userForm.userName,
					birth: _this.userForm.birth,
					sexId: _this.userForm.sexId
					// memberDto:_this.userForm
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res)
				}).catch(error => {})
			},
			deleteMember(scope) {
				let _this = this;
				console.log(scope)
				axios.post("/adminuser/dropMember", {
					id: scope.row.id,
					// memberDto:_this.userForm
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res)
					_this.handleCurrentChange(_this.memberpageNum);
				}).catch(error => {})
			},
			searchByMemberName() {
				let _this = this;
				_this.membersearchName = _this.memberinputName
				_this.getmemberData()
			},
			addMember() {
				let _this = this;
				_this.dialogMemberTableAdd = false;
				console.log(_this.addMemberForm)
				axios.post("/adminuser/addMember", {
					userPhone: _this.addMemberForm.userPhone,
					userName: _this.addMemberForm.userName,
					birth: _this.addMemberForm.birth,
					sexId: _this.addMemberForm.sexId,
					password: _this.addMemberForm.password,
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					// console.log(res)
					// _this.coachtotal = res.data.data.coachTotal
					// var resdata = res.data.data.coachList
					// console.log(resdata)
					// _this.coachTable = resdata;
					// _this.userForm.sexId = resdata.sexId
				}).catch(error => {})
			},
			addMemberButton() {
				let _this = this;
				_this.dialogMemberTableAdd = true;
				_this.addMemberForm = {}
			},
			getcoachData() {
				let _this = this;
				axios.post("/adminuser/getcoachs", {
					pageSize: _this.coachpageSize,
					pageNum: _this.coachpageNum,
					coachName: _this.coachsearchName
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res)
					_this.coachtotal = res.data.data.coachTotal
					var resdata = res.data.data.coachList
					console.log(resdata)
					_this.coachTable = resdata;
					// _this.userForm.sexId = resdata.sexId
				}).catch(error => {
					// location.href = "login.html";
				})
			},
			coachHandleSizeChange(val) {
				let _this = this;
				console.log(val + "-------------------")
				_this.coachpageSize = val;
				_this.coachpageNum = 1;
				_this.getcoachData()
			},
			coachHandleCurrentChange(val) {
				let _this = this;
				_this.coachpageNum = val;
				_this.getcoachData()
			},
			searchByCoachName() {
				let _this = this;
				_this.coachsearchName = _this.coachinputName
				_this.getcoachData()
			},
			selectCoach() {
				let _this = this;
				_this.status = 2;
				_this.getcoachData();
			},
			deleteCoach(scope) {
				let _this = this;
				console.log(scope)
				axios.post("/adminuser/removeCoach", {
					id: scope.row.id,
					// memberDto:_this.userForm
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res)
					_this.coachHandleCurrentChange(_this.coachpageNum);
				}).catch(error => {
				})
			},
			addCoachButton() {
				let _this = this;
				_this.dialogCoachTable = true;
				_this.addCoachForm = {}
			},
			addCoach() {
				let _this = this;
				_this.dialogCoachTable = false;
				axios.post("/adminuser/createCoach", {
					coachPhone: _this.addCoachForm.coachPhone,
					coachName: _this.addCoachForm.coachName,
					style: _this.addCoachForm.style,
					sexId: _this.addCoachForm.sexId,
					password: _this.addCoachForm.password,
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {

					// _this.userForm.sexId = resdata.sexId
				}).catch(error => {
					
				})
			},
			getsubjectData() {
				let _this = this;
				axios.post("/adminuser/searchSub", {
					pageSize: _this.subjectpageSize,
					pageNum: _this.subjectpageNum,
					subjectName: _this.subjectsearchName
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res)
					_this.subjecttotal = res.data.data.subjectTotal
					var resdata = res.data.data.subjectList
					console.log("--------------------")
					console.log(resdata)
					_this.subjectTable = resdata;
					// _this.userForm.sexId = resdata.sexId
				}).catch(error => {
					// location.href = "login.html";
				})
			},
			searchBySubjectName() {
				let _this = this;
				_this.subjectsearchName = _this.subjectinputName
				_this.getsubjectData()
			},
			subjectHandleSizeChange(val) {
				let _this = this;
				console.log(val + "-------------------")
				_this.subjectpageSize = val;
				_this.subjectpageNum = 1;
				_this.getsubjectData()
			},
			subjectHandleCurrentChange(val) {
				let _this = this;
				_this.subjectpageNum = val;
				_this.getsubjectData()
			},addSubjectButton() {
				let _this = this;
				_this.dialogSubjectTable = true;
				_this.addSubjectForm = {}
			},addSubject(){
				let _this = this;
				_this.dialogSubjectTable = false;
				axios.post("/adminuser/createSub", {
					subjectName: _this.addSubjectForm.subjectName,
					subjectPrice: _this.addSubjectForm.subjectPrice,
					startDate: _this.addSubjectForm.startDate,
					endDate: _this.addSubjectForm.endDate,
					coachId: _this.addSubjectForm.coachId
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {

					// _this.userForm.sexId = resdata.sexId
				}).catch(error => {})
			},deleteSubject(scope) {
				let _this = this;
				console.log(scope)
				axios.post("/adminuser/removeSub", {
					subjectId: scope.row.subjectId,
					// memberDto:_this.userForm
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res)
					_this.subjectHandleCurrentChange(_this.subjectpageNum);
				}).catch(error => {})
			},	getorderData() {
				let _this = this;
				axios.post("/adminuser/searchOrderByUserName", {
					pageSize: _this.orderpageSize,
					pageNum: _this.orderpageNum,
					userName: _this.ordersearchName
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res)
					_this.ordertotal = res.data.data.orderTotal
					var resdata = res.data.data.ordersList
					console.log("--------------------")
					console.log(resdata)
					_this.orderTable = resdata;
					// _this.userForm.sexId = resdata.sexId
				}).catch(error => {
					// location.href = "login.html";
				})
			},searchOrderByMemberName() {
				let _this = this;
				_this.ordersearchName = _this.orderinputName
				_this.getorderData()
			},orderHandleSizeChange(val) {
				let _this = this;
				console.log(val + "-------------------")
				_this.orderpageSize = val;
				_this.orderpageNum = 1;
				_this.getorderData()
			},
			orderHandleCurrentChange(val) {
				let _this = this;
				_this.orderpageNum = val;
				_this.getorderData()
			},deleteOrder(scope) {
				let _this = this;
				console.log(scope)
				axios.post("/adminuser/removeOrder", {
					id: scope.row.id,
					// memberDto:_this.userForm
				}, {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					transformRequest: function (data) {
						return Qs.stringify(data);
					}
				}).then(function (res) {
					console.log(res)
					_this.orderHandleCurrentChange(_this.orderpageNum);
				}).catch(error => {})
			},
		},
		created() {

		},
		mounted() {
			let _this = this;
			_this.getmemberData();
			_this.getcoachData();
			_this.getsubjectData();
			_this.getorderData()
		}
	});
</script>

</html>